<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>修改密码</title>
    <link rel="stylesheet" href="./css/login.css" type="text/css">
</head>
<body>
    <div class="container">
        <h2>修改密码</h2>
        
        <% 
            String username = (String) session.getAttribute("username");
            if (username == null) {
                response.sendRedirect("login.jsp");
                return;
            }
        %>
        
        <div class="info-box">
            <p><strong>当前用户：</strong><%= username %></p>
            <p>修改密码后需要重新登录。</p>
        </div>
        
        <% if (request.getAttribute("errorMessage") != null) { %>
            <div class="message error-message">
                <%= request.getAttribute("errorMessage") %>
            </div>
        <% } %>
        
        <form action="changePassword" method="post">
            <div class="form-group">
                <label for="oldPassword">旧密码:</label>
                <input type="password" id="oldPassword" name="oldPassword" required>
            </div>
            
            <div class="form-group">
                <label for="newPassword">新密码:</label>
                <input type="password" id="newPassword" name="newPassword" required>
            </div>
            
            <div class="form-group">
                <label for="confirmPassword">确认新密码:</label>
                <input type="password" id="confirmPassword" name="confirmPassword" required>
            </div>
            
            <button type="submit" class="btn">修改密码</button>
        </form>
        
        <div class="links">
            <p><a href="success.jsp">返回主页</a> | <a href="logout">退出登录</a></p>
        </div>
    </div>
</body>
</html>

